﻿package mortal.game.view.palyer.renderer
{
    import com.mui.controls.*;
    import mortal.common.global.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.display.*;
    import mortal.game.view.palyer.data.*;
    import mortal.mvc.core.*;

    public class ClothWingAttrCellRenderer extends GCellRenderer
    {
        private var _attrValue:BitmapNumberText;
        private var _upArrow:GBitmap;
        private var _upValue:GTextFiled;
        private var _attrData:AdvanceAttrData;

        public function ClothWingAttrCellRenderer()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._attrValue = UIFactory.bitmapNumberText(62, 6, "RoleInfoNum.png", 8, 10, -1, this, 14);
            this._upArrow = UIFactory.gBitmap(ImagesConst.upgradeArrow, 92 - 12 - 10 + 30, 3, this);
            this._upArrow.visible = false;
            this._upValue = UIFactory.gTextField("", 103 - 12 - 10 + 30, 0, 35 + 4, 20, this, GlobalStyle.textFormatLv);
            this._upValue.visible = false;
            Dispatcher.addEventListener(EventName.FashionShowHidePreviewAttr, this.showOrHidePreviewAttr);
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            this._attrData = param1 as AdvanceAttrData;
            if (this._attrData)
            {
                this._attrValue.text = int(this._attrData.totalValue) + "";
                this._upValue.text = this._attrData.attrUpValue + "";
                if (this._attrData.attrUpValue == 0)
                {
                    this._upArrow.visible = false;
                    this._upValue.visible = false;
                }
            }
            return;
        }// end function

        private function showOrHidePreviewAttr(event:DataEvent) : void
        {
            var _loc_2:* = event.data as Boolean;
            if (_loc_2 && this._attrData.attrUpValue != 0)
            {
                this._upArrow.visible = true;
                this._upValue.visible = true;
            }
            else
            {
                this._upArrow.visible = false;
                this._upValue.visible = false;
            }
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._attrValue.dispose();
            this._upArrow.dispose();
            this._upValue.dispose();
            this._attrValue = null;
            this._upArrow = null;
            this._upValue = null;
            this._attrData = null;
            Dispatcher.removeEventListener(EventName.FashionShowHidePreviewAttr, this.showOrHidePreviewAttr);
            return;
        }// end function

    }
}
